package com.example.demo.controller;

import com.example.demo.domain.User;
import com.example.demo.service.IUserService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Controller
@RequestMapping(value = "/user")
public class UserController {

    @Resource
    private IUserService userService;

    @GetMapping(value = "/getUserPage")
    public String getUserPage(Model model, HttpServletRequest request, HttpServletResponse response) {
        List<User> userList = userService.getUserList();
        model.addAttribute("userList", userList);
        System.out.println("用户个数为:" + userList.size());
        return "userList";
    }




}
